-
Notifications
You must be signed in to change notification settings - Fork 305
avoid some allocations when opening a connection #3364
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR reduces runtime allocations by pre-building arrays of Azure SQL endpoint strings and refactoring the IsEndpoint
helper to use these arrays instead of concatenating prefixes on each check.
- Introduces
s_azureSqlServerOnDemandEndpoints
for on-demand endpoints. - Changes
IsEndpoint
to accept astring[]
of endpoints. - Updates calls in
IsAzureSynapseOnDemandEndpoint
andIsAzureSqlServerEndpoint
to use the new arrays.
Comments suppressed due to low confidence (1)
src/Microsoft.Data.SqlClient/src/Microsoft/Data/Common/AdapterUtil.cs:781
- Add unit tests covering each value in
s_azureSqlServerOnDemandEndpoints
to verify thatIsAzureSynapseOnDemandEndpoint
correctly recognizes all intended on-demand endpoints.
internal static readonly string[] s_azureSqlServerOnDemandEndpoints = { ONDEMAND_PREFIX + AZURE_SQL,
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great efficiency win. Just a couple of comments.
src/Microsoft.Data.SqlClient/src/Microsoft/Data/Common/AdapterUtil.cs
Outdated
Show resolved
Hide resolved
@paulmedynski Comments addressed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great!
Thanks @vonzshik ! @paulmedynski Possible to get CI running? |
/azp run |
Azure Pipelines successfully started running 2 pipeline(s). |
src/Microsoft.Data.SqlClient/src/Microsoft/Data/Common/AdapterUtil.cs
Outdated
Show resolved
Hide resolved
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #3364 +/- ##
==========================================
- Coverage 65.10% 61.39% -3.72%
==========================================
Files 300 294 -6
Lines 65376 65071 -305
==========================================
- Hits 42565 39949 -2616
- Misses 22811 25122 +2311
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
@cheenamalhotra @paulmedynski PR updated |
/azp run |
Azure Pipelines successfully started running 2 pipeline(s). |
src/Microsoft.Data.SqlClient/src/Microsoft/Data/Common/AdapterUtil.cs
Outdated
Show resolved
Hide resolved
@Wraith2 Thanks, tests (and bugs) fixed. |
@cheenamalhotra @paulmedynski Could you please help with CI? |
/azp run |
Azure Pipelines successfully started running 2 pipeline(s). |
fixes #3363